/**
 * 
 */
package com.dingding.order.core.distance.dao.impl;

import java.util.List;

import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.dingding.common.core.base.dao.impl.BaseDaoImpl;
import com.dingding.common.core.beans.Stageprice;
import com.dingding.order.core.distance.dao.IStagePriceDao;

/**
 * @ClassName: StagePriceDaoImpl
 * @Description:计费规则DAO
 * @author zhouxuan
 * @date 2016年6月4日 下午2:12:17
 */
@Component("stagePriceDao")
public class StagePriceDaoImpl extends BaseDaoImpl<Stageprice> implements IStagePriceDao {

	/**
	 * 
	 * @Title: getOrderStagePriceRule
	 * @Description:获取全部计费规则
	 * @param cityNo 城市编号
	 * @return List<Stageprice> 获取到的全部计费规则
	 * @author zhouxuan
	 * 
	 * 修改人:车焕波
	 * 修改原因：需要根据城市获取不同城市的计价规则
	 * 修改内容：添加参数
	 * 修改版本：V2.3.1
	 * 修改时间：2016-07-14
	 * 
	 */
	@Override
	@Transactional(readOnly = true)
	public List<Stageprice> getOrderStagePriceRule(int cityNo) {

		List<Stageprice> stageprices = null;
		Criterion criterion = Restrictions.and(Restrictions.eq("cityNo", cityNo), Restrictions.eq("status", 1));
		try {
			stageprices = super.queryCriteriaListByOrderDesc(criterion, "stage", false);
		} catch (Exception e) {
			log.error("获取计价规则数据出现异常 类" + this.getClass() + " 方法:getOrderStagePriceRule()", e);
			return null;
		}

		return stageprices;
	}

}
